﻿using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows.Media;

namespace PC.PickleJar.VisualStudioIntegration.SmartTagging
{
	internal class UpperCaseSmartTagAction  : ISmartTagAction
	{
		private ITrackingSpan span;
		private ITextSnapshot snapshot;
		private string upper;
		private string display;

		public UpperCaseSmartTagAction(ITrackingSpan span)
		{
			this.span = span;
			this.snapshot = span.TextBuffer.CurrentSnapshot;
			this.upper = span.GetText(this.snapshot).ToUpper();
			this.display = "Convert to upper case";
		}

		//public ISmartTagSource Source
		//{
		//	get;
		//	private set;
		//}

		public ReadOnlyCollection<SmartTagActionSet> ActionSets
		{
			get
			{
				return null;
			}
		}

		public string DisplayText
		{
			get
			{
				return this.display;
			}
		}

		public ImageSource Icon
		{
			get
			{
				return null;
			}
		}

		public void Invoke()
		{
			this.span.TextBuffer.Replace(this.span.GetSpan(this.snapshot), this.upper);
		}

		public bool IsEnabled
		{
			get
			{
				return true;
			}
		}
	}
}
